package eg;

import java.io.BufferedReader;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.List;

public class demo{
    public static void main(String[] args) throws Exception
    {

        String filePath1 = "D:\\123.txt";
        List<String> list1 = getFileContext(filePath1);

        String filePath2 = "D:\\345.txt";
        List<String> list2 = getFileContext(filePath2);
        list2.removeAll(list1);

        for (int i = 0; i < list2.size(); i++)
        {
            // System.out.println("第i条记录" + i + ":" + list.get(i));
            System.out.println(list2.get(i));

        }

    }
    public static List<String> getFileContext(String path) throws Exception {
        FileReader fileReader =new FileReader(path);
        BufferedReader bufferedReader =new BufferedReader(fileReader);
        List<String> list =new ArrayList<String>();
        String str=null;
        while((str=bufferedReader.readLine())!=null) {
            if(str.trim().length()>2) {
                list.add(str);
            }
        }
        return list;
    }
}